#include<iostream>
#include<cstdio>
using namespace std;
int n,l,r;
int main(){
	freopen("candy.n","r",stdin);
	freopen("candy.out","w",stdout);
	scanf("%d%d%d",&n,&l,&r);
	int t=l/n;
	l-=n*t,r-=n*t;
	if(r>=n-1) printf("%d",n-1);
	else printf("%d",r);
}
